﻿Imports System.ComponentModel

Public Class UC_Day

#Region "Attributes"
    Public Enum Month
        <Description("Enero")>
        January = 1
        <Description("Febrero")>
        February = 2
        <Description("Marzo")>
        March = 3
        <Description("Abril")>
        April = 4
        <Description("Mayo")>
        May = 5
        <Description("Junio")>
        Jun = 6
        <Description("Julio")>
        July = 7
        <Description("Agosto")>
        August = 8
        <Description("Septiembre")>
        September = 9
        <Description("Octubre")>
        October = 10
        <Description("Noviembre")>
        November = 11
        <Description("Diciembre")>
        Dicember = 12
    End Enum
#End Region

#Region "Events"

#End Region

#Region "Methods"
    Public Sub WriteDay(ByVal pDay As Integer, ByVal pMonth As Month)
        If Not ValidateDay(pDay, pMonth) Then Return

        lblDay.Text = pDay.ToString
        lblMonth.Text = GenericMethods.GetEnumItemDescription(pMonth)
    End Sub

    Private Function ValidateDay(ByVal pDay As Integer, ByVal pMonth As Month)
        Select Case pMonth
            Case Month.January
                If pDay < 1 Or pDay > 31 Then
                    Return False
                Else
                    Return True
                End If

            Case Month.March
                If pDay < 1 Or pDay > 31 Then
                    Return False
                Else
                    Return True
                End If

            Case Month.May
                If pDay < 1 Or pDay > 31 Then
                    Return False
                Else
                    Return True
                End If

            Case Month.July
                If pDay < 1 Or pDay > 31 Then
                    Return False
                Else
                    Return True
                End If

            Case Month.February
                If pDay < 1 Or pDay > 28 Then
                    Return False
                Else
                    Return True
                End If

            Case Month.August
                If pDay < 1 Or pDay > 28 Then
                    Return False
                Else
                    Return True
                End If

            Case Month.October
                If pDay < 1 Or pDay > 28 Then
                    Return False
                Else
                    Return True
                End If

            Case Month.Dicember
                If pDay < 1 Or pDay > 28 Then
                    Return False
                Else
                    Return True
                End If

            Case Month.March
                If pDay < 1 Or pDay > 30 Then
                    Return False
                Else
                    Return True
                End If

            Case Month.Jun
                If pDay < 1 Or pDay > 30 Then
                    Return False
                Else
                    Return True
                End If

            Case Month.September
                If pDay < 1 Or pDay > 30 Then
                    Return False
                Else
                    Return True
                End If

            Case Month.November
                If pDay < 1 Or pDay > 30 Then
                    Return False
                Else
                    Return True
                End If

            Case Else
                Return False
        End Select
    End Function
#End Region

End Class
